import React, { Component } from 'react';
import Header from '../components/MyHeader/header'
import { SearchBar } from 'antd-mobile'
import '../styles/AllProducts.scss'
import {commodity_data,commodity_list} from '../apis/api'
class AllProducts extends Component {
    //     constructor(props){
    //     super(props);
    //         this.state = {
    //         } //初始化组件状态
           
    // }
    state = {
        data:[]
    }
    toSearch=() =>{
        this.props.history.push({pathname:"/search"})
    }
    componentDidMount() {
        commodity_data({searchkey:this.props.location.state.searchkey}).then((ref) => {
            console.log(ref);
        })
        commodity_list().then((ref) => {
            console.log(ref);
        })
    }
    render() {
        return (
            <div className='allProducts'>
                <div className="headers">
                    <Header back='搜索' />
                    <SearchBar placeholder='搜索好物' onFocus={this.toSearch} />
               </div>
                <div className='list'></div>
            </div>
        );
    }
}

export default AllProducts;